/**
 * Copyright (c) 2013-Now http://jeesite.com All rights reserved.
 */
package com.jeesite.modules.phone.entity;

import java.util.Date;
import com.jeesite.common.mybatis.annotation.JoinTable;
import com.jeesite.common.mybatis.annotation.JoinTable.Type;
import com.fasterxml.jackson.annotation.JsonFormat;
import javax.validation.constraints.NotNull;

import com.jeesite.common.entity.DataEntity;
import com.jeesite.common.mybatis.annotation.Column;
import com.jeesite.common.mybatis.annotation.Table;
import com.jeesite.common.mybatis.mapper.query.QueryType;

/**
 * 销售记录Entity
 * @author lzw
 * @version 2019-04-03
 */
@Table(name="sales_records", alias="a", columns={
		@Column(name="id", attrName="id", label="id", isPK=true,isInsert = false),
		@Column(name="commodity_id", attrName="commodityId", label="商品id"),
		@Column(name="number", attrName="number", label="销售数量"),
		@Column(name="sales_time", attrName="salesTime", label="销售时间"),
		@Column(name="salesman_code", attrName="salesmanCode", label="业务员编号")
	},joinTable = {
		@JoinTable(type = Type.JOIN,entity =Staff.class ,attrName = "staff",alias = "s",
				on="s.id=a.salesman_code",columns = {
				@Column(name = "id",label = "业务员ID",isPK = true),
				@Column(name = "staff_name",label = "业务员名称",isQuery = false)
		}),
		@JoinTable(type = Type.LEFT_JOIN,entity = PhoneCommodity.class,attrName = "phoneCommodity",alias = "p",
				on="p.id=a.commodity_id",columns = {
				@Column(name = "id",label = "商品ID",isPK = true),
				@Column(name = "commodity_name",label = "商品名称",isQuery = false),
				@Column(name = "product_manufacturer",label = "厂商名称",isQuery = false)
		})
}, orderBy="a.id DESC"
)
public class SalesRecords extends DataEntity<SalesRecords> {
	
	private static final long serialVersionUID = 1L;
	private Long commodityId;		// 商品id
	private Long number;		// 销售数量
	private Date salesTime;		// 销售时间
	private Long salesmanCode;		// 业务员编号
	private Staff staff;  //业务员
	private PhoneCommodity phoneCommodity;  //商品
	private String salesmanName; //业务员名称
	private Double totalPrice;		// 总金额
	private String months; //月
	private String  quarters; //季度
	private String yrars; //年
	private String productManufacturer; //厂商名称
    private String commodityName;  //商品名称
	private String productManufacturerId;
	public SalesRecords() {
		this(null);
	}

	public SalesRecords(String id){
		super(id);
	}
	
	public Long getCommodityId() {
		return commodityId;
	}

	public String getProductManufacturerId() {
		return productManufacturerId;
	}

	public void setProductManufacturerId(String productManufacturerId) {
		this.productManufacturerId = productManufacturerId;
	}

	public void setCommodityId(Long commodityId) {
		this.commodityId = commodityId;
	}
	
	public Long getNumber() {
		return number;
	}

	public void setNumber(Long number) {
		this.number = number;
	}
	
	@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
	@NotNull(message="销售时间不能为空")
	public Date getSalesTime() {
		return salesTime;
	}

	public void setSalesTime(Date salesTime) {
		this.salesTime = salesTime;
	}
	
	public Long getSalesmanCode() {
		return salesmanCode;
	}

	public void setSalesmanCode(Long salesmanCode) {
		this.salesmanCode = salesmanCode;
	}

	public Staff getStaff() {
		return staff;
	}

	public void setStaff(Staff staff) {
		this.staff = staff;
	}

	public PhoneCommodity getPhoneCommodity() {
		return phoneCommodity;
	}

	public void setPhoneCommodity(PhoneCommodity phoneCommodity) {
		this.phoneCommodity = phoneCommodity;
	}

	public String getSalesmanName() {
		return salesmanName;
	}

	public void setSalesmanName(String salesmanName) {
		this.salesmanName = salesmanName;
	}

	public Double getTotalPrice() {
		return totalPrice;
	}

	public void setTotalPrice(Double totalPrice) {
		this.totalPrice = totalPrice;
	}

	public String getMonths() {
		return months;
	}

	public void setMonths(String months) {
		this.months = months;
	}

	public String getQuarters() {
		return quarters;
	}

	public void setQuarters(String quarters) {
		this.quarters = quarters;
	}

	public String getYrars() {
		return yrars;
	}

	public void setYrars(String yrars) {
		this.yrars = yrars;
	}

	public String getProductManufacturer() {
		return productManufacturer;
	}

	public void setProductManufacturer(String productManufacturer) {
		this.productManufacturer = productManufacturer;
	}

    public String getCommodityName() {
        return commodityName;
    }

    public void setCommodityName(String commodityName) {
        this.commodityName = commodityName;
    }
}